﻿@model IEnumerable<Vms.Web.Models.SCREEN>
@{
    ViewBag.Title = "Brightness control";
    int i = 0;
}
<style>
    #space
    {
        height: 20px;
    }
    .contain
    {
     margin: 45px 5px auto;   
    }
    h1
    {
        margin-top: 20px;
        margin-bottom: 30px;
    }
</style>
<p>
   
</p>
<p>
<h1>SCREENS CONFIGURATIONS</h1>
    <div class= contain style = "text-align: right;" >
        @Html.ActionLink("Screens configuration", "Index", new { }, new { @class = "btn btn-primary" })
      <a href="#" class = "btn btn-info disabled">BrightnessControl</href></a>
    </div>

    <div id="space"></div>

</p>
<table class="table table-bordered table-striped">
    <tr>
        <th>
        Index
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            Adjust Type
        </th>
        <th>
           Brightness
        </th>
    
            
        <th colspan = 2 >
            Time - Brightness
        </th>
        
        <th colspan = 2 >
            Time - Brightness
        </th>
            
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        Vms.Web.Models.SCREEN_BRIGHTNESS sb = item.ScreenBrightness;
        string h1 = Vms.Web.Lib.Utility.TimeToString((int)(sb.nHour1 != null ? sb.nHour1 : 0), (int)(sb.nMinute1 != null ? sb.nMinute1 : 0));
        string h2 = Vms.Web.Lib.Utility.TimeToString((int)(sb.nHour2 != null ? sb.nHour2 : 0), (int)(sb.nMinute2 != null ? sb.nMinute2 : 0));
        string h3 = Vms.Web.Lib.Utility.TimeToString((int)(sb.nHour3 != null ? sb.nHour3 : 0), (int)(sb.nMinute3 != null ? sb.nMinute3 : 0));
        string h4 = Vms.Web.Lib.Utility.TimeToString((int)(sb.nHour4 != null ? sb.nHour4 : 0), (int)(sb.nMinute4 != null ? sb.nMinute4 : 0));
        i++;
    
        <tr>
        <td>
        @i
        </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Vms.Web.Lib.Utility.GetAdjustNameByValue(sb.nAdjustType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ScreenBrightness.nHandleLight)
            </td>
        @{        if (sb.nAdjustType == 1)
                  {
                <td>
                @h1 - @h2
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ScreenBrightness.nLight1)
            </td>
            <td>
                @h2 - @h1
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ScreenBrightness.nLight2)
            </td>
                  }
                  else
                  {
                      <td></td>
                      <td></td>
                      <td></td>
                      <td></td>
                  }
    }
            <td>
                @Html.ActionLink(" ", "EditBrightness", new { id = item.ScreenBrightness_Id }, new { @class = "vms-icon-edit", @title = "Edit" })
            </td>
        </tr>
    }
</table>

